<template>
	<view>
		<defes :infoData="infoData"></defes>
	</view>
</template>

<script>
	import defes from '@/components/morelist/defes.vue'
	export default {
		components: {
			defes
		},
		onLoad(query) {

			this.detid = query.detid

			this.typeid = query.typeid
		},
		data() {
			return {
				detid: '',
				typeid:'',
				infoData: {contentTitle:'',content:''}
			};
		},
		mounted() {
			if (this.typeid == 1) {
				this.getNoticeByid()
			}
			if (this.typeid == 2) {
				this.getNewsByid()

			}
		},
		methods: {
			getNewsByid() {

				this.$request.get(`/CatNews/${this.detid}`, {}).then(res => {
					console.log(res);
					if (res.code == 200) {
						const news=res.data.news
						this.infoData = {contentTitle:news.ntitle,content:news.ncontent}
					
					}

				})
			},
			getNoticeByid() {

				this.$request.get(`/CatNews/look/${this.detid}`, {}).then(res => {
					console.log(res);
					if (res.code == 200) {
						const notise=res.data.notise
						this.infoData = {contentTitle:notise.noTitle,content:notise.noContent}
					}

				})
			}
		}
	}
</script>

<style>
</style>